int count = 0;

bool LastState=false;

 void onRasing()
{
  count++;
}
void setup() {
   Serial.begin(115200); //打开串口
 
   pinMode(PB6, INPUT);//设置管脚为输入
   
   //Enable中断管脚, 中断服务程序为onChange(), 监视引脚变化
   attachInterrupt( digitalPinToInterrupt(PB6), onRasing, RISING);
}

void loop() {
  // put your main code here, to run repeatedly:
    delay(1000); 
    Serial.write(count);
    count=0;

}
